import router from "./router";
import { usetoken } from "./stores/token";


const whiteList:string[] = ['/login','/404']

    router.beforeEach((to,from,next)=>{
    const store = usetoken()
    // 有token的情况下
    if(store.getToken()){
      if(to.path === '/login'){
        next()
      }else{
        next()
      }
       // 无token的情况下
    }else{
      if(whiteList.includes(to.path)){
        next()
      }else{
        next('/login')
      }
    }
    })

router.afterEach(()=>{

})